package cn.edu.scau.cmi.zenghaonan.chapter04;

public class TheBiggestN {

	public static void main(String[] args) {
		int n=0,s=0;
		while(s<=9876) {
			int t=1;
			for(int i=n;i>=1;i--) {
				t*=i;
			}
			s+=t;
			n++;
		}
		n-=2;
		System.out.printf("%d",n);
	}

}
